<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			// var date = new Date();;
			// var year = date.getFullYear();
			// var month = date.getMonth()+1;
			// var day = date.getDate();
			// var formatDate = `${year}年${month}月${day}日`;
			// console.log(formatDate);
			
			
			var birthday = new Date('2007-5-29');
			var now = new Date();
			var daydiff;
			//获取今年生日日期
			var currYear = new Date(now.getFullYear(),birthday.getMonth(),birthday.getDate());
			
			if (now > currYear){
				currYear.setFullYear(now.getFullYear()+1); //若今年生日已过，则计算下年
			};
			daydiff = Math.ceil((currYear.getTime()-now.getTime()) / (1000*60*60*24));
			console.log(`距离下次生日${daydiff}天`);
		</script>
	</body>
</html>